//
//  noMoreDateView.m
//  ZITHER
//
//  Created by weixin on 2018/11/21.
//  Copyright © 2018 weixn. All rights reserved.
//

#import "noMoreDateView.h"
#import "Ugc_Release_VC_WX_V4.h"
#import "MainDiscernVC.h"

@implementation noMoreDateView


-(void)setNoMoreDataBg:(BOOL)type NoDataState:(NoMoreDataState)NoDataState{
    self.hidden = type;


    switch (NoDataState) {
        case NoMoreDataStateDefault:
            [self setDefault];
            break;
        case NoMoreDataStatePublish:
            [self setPublishState];
            break;
        case NoMoreDataStateDiscernVC:
            [self setNoMoreDataStateDiscernVC];
            break;
   
        default:
            break;
    }
    
}

-(void)setDefault{
    self.Publishbtn.hidden = YES;
    self.btnShoot.hidden = YES;
    self.btnClause.hidden = YES;
}

-(void)setPublishState{
    self.title.text = @"还没有发布过创作";
    self.Publishbtn.hidden = NO;
    self.btnShoot.hidden = YES;
    self.btnClause.hidden = YES;
}

-(void)setNoMoreDataStateDiscernVC{
    self.title.text = @"抱歉，没有识别结果";
    self.btnShoot.hidden = YES;
    self.btnClause.hidden = YES;
    self.Publishbtn.hidden = YES;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithHex:@"F5F5F5"];
        [self setUI];
        [self setMasonry];
        self.hidden = YES;
        
    }
    return self;
}

-(void)setUI{
    [self addSubview:self.iamge];
    [self addSubview:self.title];
    [self addSubview:self.Publishbtn];
    [self addSubview:self.btnShoot];
    [self addSubview:self.btnClause];
}

-(void)setMasonry{
    [self.iamge mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX).offset(0);
        make.top.equalTo(self.mas_top).offset(60);
        make.height.mas_equalTo(100);
    }];
    [self.title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX).offset(0);
        make.top.equalTo(self.iamge.mas_bottom).offset(30);
    }];
    [self.Publishbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(15);
        make.right.equalTo(self).offset(-15);
        make.top.equalTo(self.title.mas_bottom).offset(30);
        make.height.mas_equalTo(45);
    }];
    
    [self.btnShoot mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.btnClause.mas_bottom).offset(15);
        make.right.equalTo(self).offset(-15);
        make.left.equalTo(self).offset(15);
        make.height.mas_offset(45);
        
    }];
    
    [self.btnClause mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.title.mas_bottom).offset(65);
        make.right.equalTo(self).offset(-15);
        make.left.equalTo(self).offset(15);
        make.height.mas_offset(45);
    }];
    
}

-(BaseImageV *)iamge{
    if (!_iamge) {
        _iamge = [[BaseImageV alloc]initializeFrame:CGRectMake(0, 0, 0, 0) contentMode:2];
        _iamge.image = [UIImage imageNamed:@"空状态站位图"];
        _iamge.backgroundColor = [UIColor clearColor];

    }
    return _iamge;
}

-(BaseLab *)title{
    if (!_title) {
        _title = [[BaseLab alloc]initializeFrame:CGRectMake(0, 0, 0, 0) text:@"还没有发布过创作" font:12 textColor:[UIColor blackColor] isBold:NO numberOfLines:1];
        _title.font = [UIFont fontWithName:@"PingFangSC-Medium" size:17];
        _title.textColor = [UIColor colorWithHex:@"999999"];
        _title.backgroundColor = [UIColor clearColor];

    }
    return _title;
}

-(BaseBtn *)Publishbtn{
    if (!_Publishbtn) {
        _Publishbtn = [[BaseBtn alloc]initializeFrame:CGRectMake(0, 0, 0, 0) NormalText:@"快速发布" NormalTextColor:[UIColor whiteColor] SeleText:@"快速发布" SeleTextColor:[UIColor whiteColor] font:12 isBold:NO];
        [_Publishbtn setCornerRadiusWithRadius:4 isMasks:YES];
        _Publishbtn.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Medium" size:15];
        _Publishbtn.backgroundColor = baseColorTheme;
        @weakify(self);
        [[_Publishbtn rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            Ugc_Release_VC_WX_V4 * vc= [[Ugc_Release_VC_WX_V4 alloc]init];
            [self.getNav pushViewController:vc animated:YES];
        }];
    }
    return _Publishbtn;
}

-(BaseBtn *)btnClause{
    if (!_btnClause) {
        _btnClause = [[BaseBtn alloc]initializeFrame:CGRectMake(0, 0, 1, 1) NormalText:@"识别不准？我要去认证" NormalTextColor:baseColorTheme SeleText:@"" SeleTextColor:baseColorTheme  font:14 isBold:NO];
        _btnClause.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:14];
        _btnClause.backgroundColor = [UIColor clearColor];
        [_btnClause setCornerRadiusWithRadius:4 isMasks:YES];
        [_btnClause setBorderWithColor:baseColorTheme width:1];
        _btnClause.hidden = YES;
        /** 按钮点击案例 */
        @weakify(self);
        [[_btnClause rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            MainDiscernVC *vc = [[MainDiscernVC alloc]init];
            [self.getNav pushViewController:vc animated:YES];
        }];
    }
    return _btnClause;
}

-(BaseBtn *)btnShoot{
    if (!_btnShoot) {
        _btnShoot = [[BaseBtn alloc]initializeFrame:CGRectMake(0, 0, 1, 1) NormalText:@"  重新拍摄" NormalTextColor:baseColorTheme SeleText:@"" SeleTextColor:baseColorTheme  font:15 isBold:NO];
        [_btnShoot setImage:[UIImage imageNamed:@"识别结果_相机"] forState:UIControlStateNormal];
        _btnShoot.backgroundColor = [UIColor clearColor];
        _btnShoot.hidden = YES;
        [_btnShoot setCornerRadiusWithRadius:4 isMasks:YES];
        [_btnShoot setBorderWithColor:baseColorTheme width:1];
        /** 按钮点击案例 */
        @weakify(self);
        [[_btnShoot rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            [self.getNav popViewControllerAnimated:YES];
        }];
    }
    return _btnShoot;
}
@end
